package com.share.tool.mock.init;

import com.share.tool.mock.service.HttpVariableService;
import com.share.tool.mock.service.ISourceConfService;
import com.share.tool.mock.service.VariableService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

@Slf4j
@Component
public class BootInit {
    @Autowired
    private HttpVariableService morkHttpVariableService;
    @Autowired
    private ISourceConfService sourceConfService;
    @Autowired
    private VariableService morkVariableService;

    @PostConstruct
    @Scheduled(cron = "0 0/30 * * * ?")
    public void initHttp() {
        log.info("---正在初始化HttpMorkConfig---");
        morkHttpVariableService.init();

        log.info("---正在初始化mockVariableService---");
        morkVariableService.init();

        log.info("---正在初始化sourceConfService---");
        sourceConfService.init();
    }
}
